package cn.minhx.domain.activity.model.valobj;

import java.util.Arrays;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;

/**
 * 拼团活动状态枚举
 *
 * @author min
 */
@Getter
@NoArgsConstructor
@AllArgsConstructor
public enum ActivityStatusEnumVO {
	CREATE(0, "创建"), EFFECTIVE(1, "生效"), OVERDUE(2, "过期"), ABANDONED(3, "废弃"),;

	private Integer code;
	private String info;

	public static ActivityStatusEnumVO valueOf(Integer code) {
		return Arrays.stream(values()).filter(activityStatusEnumVO -> activityStatusEnumVO.getCode().equals(code))
				.findFirst().orElseThrow(() -> new RuntimeException("err code not exist!"));
	}
}
